--CREATE OR REPLACE PROCEDURE PRSM_ALL_MS_UPDATE AS
DECLARE
  TYPE rs  is TABLE OF PRSM_MS_MV%ROWTYPE;
BEGIN
  SELECT * 
    BULK COLLECT INTO rs 
    FROM PRSM_MS_MV;
    IF rs.COUNT > 0 THEN
       
       UPDATE PRSM_ALL_MS    = rs(i).
          SET IMPL_AGENCY    = rs(i).IMPL_AGENCY
              FINISH_DATE    = rs(i).FINISH_DATE
              PERCENT_COMP   = rs(i).PERCENT_COMP
              LAST_MODIFY_DT = SYSDATE
        WHERE EFIS_ID        = rs(i).EFIS_ID
              DISTRICT_CODE  = rs(i).DISTRICT_CODE
              EA5            = rs(i).EA5
              MILESTONE      = rs(i).MILESTONE
              FY             = rs(i).FY
              QTR            = rs(i).QTR
        if sql%rowcount = 0 then
          insert into  PRSM_ALL_MS 
          (  EFIS_ID
DISTRICT_CODE
EA5
MILESTONE
IMPL_AGENCY
FINISH_DATE
FY
QTR
PROJ_MGR
PERCENT_COMP
IS_MILESTONE
TASKNAME
LAST_MODIFY_DT)values
(
 EFIS_ID
DISTRICT_CODE
EA5
MILESTONE
IMPL_AGENCY
FINISH_DATE
FY
QTR
PROJ_MGR
PERCENT_COMP
IS_MILESTONE
TASKNAME
 sysdate
)
        end if;
          
       END LOOP;   
    END IF;
END;
